import 'dart:core';

import 'package:cat_eye/config/color_config.dart';
import 'package:cat_eye/config/string_config.dart';
import 'package:cat_eye/provider/app_Info_provider.dart';
import 'package:cat_eye/root_page/root_page.dart';
import 'package:cat_eye/util/sp_util.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (BuildContext context) {
        return AppInfoProvider();
      },
      child: Consumer<AppInfoProvider>(
        builder: (context, AppInfoProvider appInfo, child) {
          return MaterialApp(
            title: '猫眼',
            theme: ThemeData(
              //主题模式
              primaryColor: ColorConfig.themeColorMap[appInfo.themeColor],
              //夜间模式
              brightness: ColorConfig.brightnessColorMap[appInfo.themeMode],
            ),
            home: RootPage(),
          );
        },
      ),
    );
  }
}
